import 'dart:convert';

import 'package:json_annotation/json_annotation.dart';
part 'list_data.g.dart';

@JsonSerializable(genericArgumentFactories: true)
class ListData<T> {
  bool has_more = false;
  String? page_token;
  List<T>? items;

  ListData();

  factory ListData.fromJson(
      Map<String, dynamic> json, T Function(dynamic json) fromJsonT) =>
      _$ListDataFromJson<T>(json, fromJsonT);

  Map<String, dynamic> toJson(Object? Function(T value) toJsonT) =>
      _$ListDataToJson(this, toJsonT);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
